<div class="layui-row layui-col-space16">
	<div class="layui-col-md12">
		<div class="layui-card">
			<div id="chartGood" style="width: 100%;height:300px;"></div>
		</div>
	</div>
</div>
<script>
	var chartGood;
	function layoutGood() {
		chartGood = echarts.init(document.getElementById('chartGood'));
		$.ajax({
			url: "/home/api/get_good",
			type: 'get',
			data: {},
			success: function (e) {
				if (e.code == 0) {
					var dataKey = Object.keys(e.data);
					let dataArr = dataKey.map(v => e.data[v]);
					var ops = {
						title: {
							top: '12px',
							text: '物品领用费用统计表',
							left: '8px',
							textStyle: {
								fontSize: '18',
								color: '#333',
							}
						},
						tooltip: {
							trigger: 'axis',
							axisPointer: {
								type: 'shadow'
							},
							formatter: '￥ {c}'
						},
						xAxis: {
							type: 'category',
							data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
						},
						yAxis: {
							type: 'value',
							axisLabel: {
								formatter: '￥ {value}'
							}
						},
						legend: {
							data: [{ name: '项目合计' }],
							top: '16px',
						},
						series: [
							{
								data: dataArr,
								type: 'bar'
							}
						]
					}
					chartGood.setOption(ops);
				}
			}
		})
	}
</script>